package com.logicalthinking.socialmall.controller.admin;

import com.github.chenlijia1111.utils.common.Result;
import com.logicalthinking.socialmall.biz.ClientUserBiz;
import com.logicalthinking.socialmall.common.vo.requestVo.clientUser.*;
import com.logicalthinking.socialmall.common.vo.responseVo.clientUser.ClientUserListVo;
import com.logicalthinking.socialmall.common.vo.responseVo.clientUser.ClientUserSimpleInfoVo;
import com.logicalthinking.socialmall.entity.ClientAuthenticateShop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import sun.security.krb5.internal.PAData;

import java.util.List;

/**
 * 客户端用户
 *
 * @author chenLiJia
 * @since 2020-02-17 14:43:59
 **/
@RestController
@RequestMapping(value = "admin/clientUser")
@Api(tags = "客户端用户管理")
public class ClientUserController {

    @Autowired
    private ClientUserBiz biz;//客户端用户


    /**
     * 添加未认证用户
     * @param params
     * @return
     */
    @PostMapping(value = "addNotAuthenticateUser")
    @ApiOperation(value = "添加未认证用户")
    public Result addNotAuthenticateUser(AdminAddClientUserParams params){
        return biz.addNotAuthenticateUser(params);
    }

    /**
     * 添加个人认证用户
     * @param params
     * @return
     */
    @PostMapping(value = "addAuthenticateSelfUser")
    @ApiOperation(value = "添加个人认证用户")
    public Result addAuthenticateSelfUser(AdminAddClientUserParams params){
        return biz.addAuthenticateSelfUser(params);
    }

    /**
     * 添加商家认证用户
     * @param params
     * @return
     */
    @PostMapping(value = "addAuthenticateSelfShop")
    @ApiOperation(value = "添加商家认证用户")
    public Result addAuthenticateSelfShop(AdminAddClientUserToShopParams params){
        return biz.addAuthenticateSelfShop(params);
    }


    /**
     * 后台列表查询小程序用户列表
     *
     * @param params
     * @return
     */
    @GetMapping(value = "listPage")
    @ApiOperation(value = "列表查询小程序用户列表", response = ClientUserListVo.class)
    public Result adminListPage(ClientListQueryParams params) {
        return biz.adminListPage(params);
    }

    /**
     * 主键查询
     *
     * @param id
     * @return
     */
    @GetMapping(value = "finById")
    @ApiOperation(value = "主键查询", response = ClientUserSimpleInfoVo.class)
    public Result adminFindById(Integer id) {
        return biz.adminFindById(id);
    }


    /**
     * 修改小程序用户信息
     *
     * @param params
     * @return
     */
    @PostMapping(value = "update")
    @ApiOperation(value = "修改小程序用户信息")
    public Result adminUpdate(AdminUpdateClientUserParams params) {
        return biz.adminUpdate(params);
    }

    /**
     * 修改小程序用户为商家会员
     *
     * @param params
     * @return
     */
    @PostMapping(value = "UpdateClientToShop")
    @ApiOperation(value = "修改小程序用户为商家会员")
    public Result adminUpdateClientToShop(AdminUpdateClientUserToShopParams params) {
        return biz.adminUpdateClientToShop(params);
    }

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @PostMapping(value = "delete")
    @ApiOperation(value = "删除")
    public Result delete(Integer id) {
        return biz.delete(id);
    }

    /**
     * 批量删除
     *
     * @param idList
     * @return
     */
    @PostMapping(value = "delete/batch")
    @ApiOperation(value = "批量删除")
    public Result batchDelete(@RequestBody List<Integer> idList) {
        return biz.batchDelete(idList);
    }

    /**
     * 启用
     *
     * @param id
     * @return
     */
    @PostMapping(value = "enable")
    @ApiOperation(value = "启用")
    public Result enable(Integer id) {
        return biz.enable(id);
    }

    /**
     * 批量启用
     *
     * @param idList
     * @return
     */
    @PostMapping(value = "enable/batch")
    @ApiOperation(value = "批量启用")
    public Result batchEnable(@RequestBody List<Integer> idList) {
        return biz.batchEnable(idList);
    }

    /**
     * 禁用
     *
     * @param id
     * @return
     */
    @PostMapping(value = "disable")
    @ApiOperation(value = "禁用")
    public Result disable(Integer id) {
        return biz.disable(id);
    }

    /**
     * 批量禁用
     *
     * @param idList
     * @return
     */
    @PostMapping(value = "disable/batch")
    @ApiOperation(value = "批量禁用")
    public Result batchDisable(@RequestBody List<Integer> idList) {
        return biz.batchDisable(idList);
    }


    /**
     * 商家申请列表查询
     *
     * @param params
     * @return
     */
    @GetMapping(value = "shopApply/listPage")
    @ApiOperation(value = "商家申请列表查询")
    public Result listPageShopApply(ClientUserShopApplyQueryParams params) {
        return biz.listPageShopApply(params);
    }

    /**
     * 同意商家申请
     *
     * @param id
     * @return
     */
    @PostMapping(value = "shopApply/agree")
    @ApiOperation(value = "同意商家申请")
    public Result agreeShopApply(Integer id) {
        return biz.agreeShopApply(id);
    }

    /**
     * 批量同意商家申请
     *
     * @return
     */
    @PostMapping(value = "shopApply/agree/batch")
    @ApiOperation(value = "批量同意商家申请")
    public Result batchAgreeShopApply(@RequestBody List<Integer> idList) {
        return biz.batchAgreeShopApply(idList);
    }

    /**
     * 拒绝商家申请
     *
     * @return
     */
    @PostMapping(value = "shopApply/deny")
    @ApiOperation(value = "拒绝商家申请")
    public Result denyShopApply(Integer id) {
        return biz.denyShopApply(id);
    }

    /**
     * 批量拒绝商家申请
     *
     * @return
     */
    @PostMapping(value = "shopApply/deny/batch")
    @ApiOperation(value = "批量拒绝商家申请")
    public Result batchDenyShopApply(@RequestBody List<Integer> idList) {
        return biz.batchDenyShopApply(idList);
    }

    /**
     * 查询商家申请详情
     *
     * @return
     */
    @GetMapping(value = "shopApply/findInfo")
    @ApiOperation(value = "查询商家申请详情",response = ClientAuthenticateShop.class)
    public Result findShopApplyInfo(Integer id) {
        return biz.findShopApplyInfo(id);
    }
}
